<?php
/**
 * BTIAPIService.php
 * description:
 * Created by www.
 * User: SCF
 * Date: 2018/9/20 11:26
 *
 */

namespace App\Services\ThirdAPI;



class SBTECHAPIService
{
    protected $apiName = 'SBTECH';
    /**
     * 拉取所有已结算注单
     * @param $from
     * @param $to
     * @return mixed
     */
    public function bettingHistory($from, $to)
    {
        $data = [
            'api_name' => $this->apiName,
            'start_time' => date('Y-m-d H:i:s',strtotime($from)+4*3600),
            'end_time' => date('Y-m-d H:i:s',strtotime($to)+4*3600),
            'type' => 1
        ];
        $url = config('app.rpcserver') . "/api/getOrders";
        $res = GameApiService::request($url,'get',$data);
        amount_format_array($res,['bet_money','prize_money','winloss_money','contribute_money','bonus_money','valid_money'],true);
        return $res;
    }

    /**
     * 拉取所有未结算注单
     * @param $from
     * @param $to
     * @return mixed
     */
    public function openBets($from, $to)
    {
        $data = [
            'api_name' => $this->apiName,
            'start_time' => date('Y-m-d H:i:s',strtotime($from)+4*3600),
            'end_time' => date('Y-m-d H:i:s',strtotime($to)+4*3600),
            'type' => 0
        ];
        $url = config('app.rpcserver') . "/api/getOrders";
        $res = GameApiService::request($url,'get',$data);
        amount_format_array($res,['bet_money','prize_money','winloss_money','contribute_money','bonus_money','valid_money'],true);
        return $res;
    }
}